// hostVal  用于登录判断是否从首页来
localStorage.setItem("hostVal", 1)
var token = localStorage.getItem("token"),
    homeData = '',
    start = 0,
    ii = ''
localStorage.removeItem("inDetailsPage")


if (localStorage.getItem("Refresh") == 1) {
    localStorage.setItem("Refresh", 0)
    history.go(0)
}

if (token) {
    homeData = Sendajax("http://119.23.46.241:8080/login/index", "post", {start: 0}, token)
    $(window).on("touchmove", function () {
        var scrollTop = $(this).scrollTop();
        var scrollHeight = $(document).height();
        var windowHeight = $(this).height();
        if (scrollTop + windowHeight >= scrollHeight - 300) {
            start += 5
            homeData = Sendajax("http://119.23.46.241:8080/login/index", "post", {start: start}, token)
            showScrollDynamic(homeData.data)
        }
    });
} else {
    homeData = Sendajax("http://119.23.46.241:8080/home/index", "post", {start: 0}, "")
    $(window).on("touchmove", function () {
        var scrollTop = $(this).scrollTop();
        var scrollHeight = $(document).height();
        var windowHeight = $(this).height();
        if (scrollTop + windowHeight >= scrollHeight - 300) {
            start += 5
            homeData = Sendajax("http://119.23.46.241:8080/home/index", "post", {start: start}, "")
            showScrollDynamic(homeData.data)
        }
    });
}

//显示动态内容
showDynamic(homeData.data)

function showDynamic(data) {
    let homeContent = ''
    if (data != 0) {
        $.each(data, function (i, val) {
            if (val["titImg"]) {
                if (val.headImg) {
                    homeContent += `   <section class="user-dynamic dynamic">
                   <a href="detailsPage.html" data-detailsId="${val['id']}">
                   <!--        用户动态信息-->
                   <section class="user-dynamic-information">
                   <!--            用户动态信息头像-->
                   <section class="user-dynamic-information-headImg">
                   <img src="${val['headImg']}" alt="">
                   </section>
                   <!--            用户动态发布信息-->
                   <section class="user-dynamic-release-information">
                   <section class="user-dynamic-release-information-details">
                   <!--              用户动态发布信息名称  -->
                   <section class="user-dynamic-release-information-name" data-uId="${val['uid']}"><p>${val['username']}</p></section>
               <!--                用户动态发布信息地点-->
               <section class="user-dynamic-release-information-address">
                   <p>${val['position']}</p>
                   <section class="user-dynamic-irelease-nformation-address-icon"></section>
                   </section>
                   </section>
                   <!--                用户动态发布信息发布时间-->
                   <section class="user-dynamic-release-information-time"><p>${val['time']}</p></section>
               </section>
               </section>
               <!--                用户动态关键字-->
               <section class="user-dynamic-keywords"><span>${val['label']}</span></section>
               <!--                用户动态内容-->
               <section class="user-dynamic-content">
                 ${val['title']}
           </section>
               <!--                用户动态照片-->
               <section class="user-dynamic-images">
                   <img src="${val['titImg']}" alt="">
                   </section>
                        </a>
                   <!--                用户动态操作-->
                   <section class="user-dynamic-operation">
                   <section class="user-dynamic-operation-like">
                   <section class="user-dynamic-operation-like-icon" data-isLike="${val["isLike"]}"></section>
                   <p>${val['likeNum']}</p>
                   </section>
                   <section class="user-dynamic-operation-browse">
                   <section class="user-dynamic-operation-browse-icon"></section>
                   <p>${val['look']}</p>
                   </section>
                   <section class="user-dynamic-operation-transpond">
                   <section class="user-dynamic-operation-transpond-icon"></section>
                   <p>${val['forward']}</p>
                   </section>
                   </section>
                   </section>`
                } else {
                    homeContent += `   <section class="user-dynamic dynamic">
                   <a href="detailsPage.html" data-detailsId="${val['id']}">
                   <!--        用户动态信息-->
                   <section class="user-dynamic-information">
                   <!--            用户动态信息头像-->
                   <section class="user-dynamic-information-headImg">
                    <p>${val.name.substr(-2)}</p>
                   </section>
                   <!--            用户动态发布信息-->
                   <section class="user-dynamic-release-information">
                   <section class="user-dynamic-release-information-details">
                   <!--              用户动态发布信息名称  -->
                   <section class="user-dynamic-release-information-name" data-uId="${val['uid']}"><p>${val['username']}</p></section>
               <!--                用户动态发布信息地点-->
               <section class="user-dynamic-release-information-address">
                   <p>${val['position']}</p>
                   <section class="user-dynamic-irelease-nformation-address-icon"></section>
                   </section>
                   </section>
                   <!--                用户动态发布信息发布时间-->
                   <section class="user-dynamic-release-information-time"><p>${val['time']}</p></section>
               </section>
               </section>
               <!--                用户动态关键字-->
               <section class="user-dynamic-keywords"><span>${val['label']}</span></section>
               <!--                用户动态内容-->
               <section class="user-dynamic-content">
                 ${val['title']}
           </section>
               <!--                用户动态照片-->
               <section class="user-dynamic-images">
                   <img src="${val['titImg']}" alt="">
                   </section>
                        </a>
                   <!--                用户动态操作-->
                   <section class="user-dynamic-operation">
                   <section class="user-dynamic-operation-like">
                   <section class="user-dynamic-operation-like-icon" data-isLike="${val["isLike"]}"></section>
                   <p>${val['likeNum']}</p>
                   </section>
                   <section class="user-dynamic-operation-browse">
                   <section class="user-dynamic-operation-browse-icon"></section>
                   <p>${val['look']}</p>
                   </section>
                   <section class="user-dynamic-operation-transpond">
                   <section class="user-dynamic-operation-transpond-icon"></section>
                   <p>${val['forward']}</p>
                   </section>
                   </section>
                   </section>`
                }
            } else {
                if (val.headImg) {
                    homeContent += `<section class="user-dynamic-text dynamic">
                 <a href="detailsPage.html" data-detailsId="${val['id']}">
                   <section class="user-dynamic-text-information">
                   <!--            用户动态信息头像-->
                   <section class="user-dynamic-text-information-headImg">
                   <img src="${val['headImg']}" alt="">
                   </section>
                   <!--            用户动态发布信息-->
                   <section class="user-dynamic-text-release-information">
                   <section class="user-dynamic-text-release-information-details">
                   <!--              用户动态发布信息名称  -->
                   <section class="user-dynamic-text-release-information-name" data-uId="${val['uid']}"><p>${val['username']}</p></section>
               <!--                用户动态发布信息地点-->
               <section class="user-dynamic-text-release-information-address">
                   <p>${val['position']}</p>
                   <section class="user-dynamic-text-irelease-nformation-address-icon"></section>
                   </section>
                   </section>
                   <!--                用户动态发布信息发布时间-->
                   <section class="user-dynamic-text-release-information-time"><p>${val['time']}</p></section>
               </section>
               </section>
               <!--                用户动态关键字-->
               <section class="user-dynamic-text-keywords"><span>${val['label']}</section>
               <!--                用户动态内容-->
               <section class="user-dynamic-text-content">
                   <p>${val['title']}</p>
               </section>
                 </a>
               <!--                用户动态操作-->
               <section class="user-dynamic-text-operation">
                   <section class="user-dynamic-text-operation-like">
                   <section class="user-dynamic-text-operation-like-icon" data-isLike="${val["isLike"]}"></section>
                   <p>${val['likeNum']}</p>
                   </section>
                   <section class="user-dynamic-text-operation-browse">
                   <section class="user-dynamic-text-operation-browse-icon"></section>
                   <p>${val['look']}</p>
                   </section>
                   <section class="user-dynamic-text-operation-transpond">
                   <section class="user-dynamic-text-operation-transpond-icon"></section>
                   <p>${val['forward']}</p>
                   </section>
                   </section>
                   </section>`
                } else {
                    homeContent += `<section class="user-dynamic-text dynamic">
                 <a href="detailsPage.html" data-detailsId="${val['id']}">
                   <section class="user-dynamic-text-information">
                   <!--            用户动态信息头像-->
                   <section class="user-dynamic-text-information-headImg">
                  <p>${val.name.substr(-2)}</p>
                   </section>
                   <!--            用户动态发布信息-->
                   <section class="user-dynamic-text-release-information">
                   <section class="user-dynamic-text-release-information-details">
                   <!--              用户动态发布信息名称  -->
                   <section class="user-dynamic-text-release-information-name" data-uId="${val['uid']}"><p>${val['username']}</p></section>
               <!--                用户动态发布信息地点-->
               <section class="user-dynamic-text-release-information-address">
                   <p>${val['position']}</p>
                   <section class="user-dynamic-text-irelease-nformation-address-icon"></section>
                   </section>
                   </section>
                   <!--                用户动态发布信息发布时间-->
                   <section class="user-dynamic-text-release-information-time"><p>${val['time']}</p></section>
               </section>
               </section>
               <!--                用户动态关键字-->
               <section class="user-dynamic-text-keywords"><span>${val['label']}</section>
               <!--                用户动态内容-->
               <section class="user-dynamic-text-content">
                   <p>${val['title']}</p>
               </section>
                 </a>
               <!--                用户动态操作-->
               <section class="user-dynamic-text-operation">
                   <section class="user-dynamic-text-operation-like">
                   <section class="user-dynamic-text-operation-like-icon" data-isLike="${val["isLike"]}"></section>
                   <p>${val['likeNum']}</p>
                   </section>
                   <section class="user-dynamic-text-operation-browse">
                   <section class="user-dynamic-text-operation-browse-icon"></section>
                   <p>${val['look']}</p>
                   </section>
                   <section class="user-dynamic-text-operation-transpond">
                   <section class="user-dynamic-text-operation-transpond-icon"></section>
                   <p>${val['forward']}</p>
                   </section>
                   </section>
                   </section>`
                }
            }
        })
        homeContent += `<section class="end">
        <section></section>
        <p>到底了</p>
        </section>`
    } else {
        homeContent = `<section class="no-content">
    <section></section>
    <p>暂无内容</p>
    </section>`
    }
    $(".container").html(homeContent)
    //显示是否点赞
    $.each($(".user-dynamic-operation-like-icon"), function (i, val) {
        if ($(val).attr("data-islike") == 1) {
            $(this).css("background", "url('https://19jwshow.oss-cn-shenzhen.aliyuncs.com/images/Heart%403x.png') no-repeat center center")
        }
    })
    $.each($(".user-dynamic-text-operation-like-icon"), function (i, val) {
        if ($(val).attr("data-islike") == 1) {
            $(this).css("background", "url('https://19jwshow.oss-cn-shenzhen.aliyuncs.com/images/Heart%403x.png') no-repeat center center")
        }
    })
}

function showScrollDynamic(data) {
    let homeScrollContent = ''
    if (data.length != 0) {
        $.each(data, function (i, val) {
            if (val["titImg"]) {
                if (val.headImg) {
                    homeScrollContent += `   <section class="user-dynamic dynamic">
                   <a href="detailsPage.html" data-detailsId="${val['id']}">
                   <!--        用户动态信息-->
                   <section class="user-dynamic-information">
                   <!--            用户动态信息头像-->
                   <section class="user-dynamic-information-headImg">
                   <img src="${val['headImg']}" alt="">
                   </section>
                   <!--            用户动态发布信息-->
                   <section class="user-dynamic-release-information">
                   <section class="user-dynamic-release-information-details">
                   <!--              用户动态发布信息名称  -->
                   <section class="user-dynamic-release-information-name" data-uId="${val['uid']}"><p>${val['username']}</p></section>
               <!--                用户动态发布信息地点-->
               <section class="user-dynamic-release-information-address">
                   <p>${val['position']}</p>
                   <section class="user-dynamic-irelease-nformation-address-icon"></section>
                   </section>
                   </section>
                   <!--                用户动态发布信息发布时间-->
                   <section class="user-dynamic-release-information-time"><p>${val['time']}</p></section>
               </section>
               </section>
               <!--                用户动态关键字-->
               <section class="user-dynamic-keywords"><span>${val['label']}</span></section>
               <!--                用户动态内容-->
               <section class="user-dynamic-content">
                 ${val['title']}
           </section>
               <!--                用户动态照片-->
               <section class="user-dynamic-images">
                   <img src="${val['titImg']}" alt="">
                   </section>
                        </a>
                   <!--                用户动态操作-->
                   <section class="user-dynamic-operation">
                   <section class="user-dynamic-operation-like">
                   <section class="user-dynamic-operation-like-icon" data-isLike="${val["isLike"]}"></section>
                   <p>${val['likeNum']}</p>
                   </section>
                   <section class="user-dynamic-operation-browse">
                   <section class="user-dynamic-operation-browse-icon"></section>
                   <p>${val['look']}</p>
                   </section>
                   <section class="user-dynamic-operation-transpond">
                   <section class="user-dynamic-operation-transpond-icon"></section>
                   <p>${val['forward']}</p>
                   </section>
                   </section>
                   </section>`
                } else {
                    homeScrollContent += `   <section class="user-dynamic dynamic">
                   <a href="detailsPage.html" data-detailsId="${val['id']}">
                   <!--        用户动态信息-->
                   <section class="user-dynamic-information">
                   <!--            用户动态信息头像-->
                   <section class="user-dynamic-information-headImg">
                    <p>${val.name.substr(-2)}</p>
                   </section>
                   <!--            用户动态发布信息-->
                   <section class="user-dynamic-release-information">
                   <section class="user-dynamic-release-information-details">
                   <!--              用户动态发布信息名称  -->
                   <section class="user-dynamic-release-information-name" data-uId="${val['uid']}"><p>${val['username']}</p></section>
               <!--                用户动态发布信息地点-->
               <section class="user-dynamic-release-information-address">
                   <p>${val['position']}</p>
                   <section class="user-dynamic-irelease-nformation-address-icon"></section>
                   </section>
                   </section>
                   <!--                用户动态发布信息发布时间-->
                   <section class="user-dynamic-release-information-time"><p>${val['time']}</p></section>
               </section>
               </section>
               <!--                用户动态关键字-->
               <section class="user-dynamic-keywords"><span>${val['label']}</span></section>
               <!--                用户动态内容-->
               <section class="user-dynamic-content">
                 ${val['title']}
           </section>
               <!--                用户动态照片-->
               <section class="user-dynamic-images">
                   <img src="${val['titImg']}" alt="">
                   </section>
                        </a>
                   <!--                用户动态操作-->
                   <section class="user-dynamic-operation">
                   <section class="user-dynamic-operation-like">
                   <section class="user-dynamic-operation-like-icon" data-isLike="${val["isLike"]}"></section>
                   <p>${val['likeNum']}</p>
                   </section>
                   <section class="user-dynamic-operation-browse">
                   <section class="user-dynamic-operation-browse-icon"></section>
                   <p>${val['look']}</p>
                   </section>
                   <section class="user-dynamic-operation-transpond">
                   <section class="user-dynamic-operation-transpond-icon"></section>
                   <p>${val['forward']}</p>
                   </section>
                   </section>
                   </section>`
                }
            } else {
                if (val.headImg) {
                    homeScrollContent += `<section class="user-dynamic-text dynamic">
                 <a href="detailsPage.html" data-detailsId="${val['id']}">
                   <section class="user-dynamic-text-information">
                   <!--            用户动态信息头像-->
                   <section class="user-dynamic-text-information-headImg">
                   <img src="${val['headImg']}" alt="">
                   </section>
                   <!--            用户动态发布信息-->
                   <section class="user-dynamic-text-release-information">
                   <section class="user-dynamic-text-release-information-details">
                   <!--              用户动态发布信息名称  -->
                   <section class="user-dynamic-text-release-information-name" data-uId="${val['uid']}"><p>${val['username']}</p></section>
               <!--                用户动态发布信息地点-->
               <section class="user-dynamic-text-release-information-address">
                   <p>${val['position']}</p>
                   <section class="user-dynamic-text-irelease-nformation-address-icon"></section>
                   </section>
                   </section>
                   <!--                用户动态发布信息发布时间-->
                   <section class="user-dynamic-text-release-information-time"><p>${val['time']}</p></section>
               </section>
               </section>
               <!--                用户动态关键字-->
               <section class="user-dynamic-text-keywords"><span>${val['label']}</section>
               <!--                用户动态内容-->
               <section class="user-dynamic-text-content">
                   <p>${val['title']}</p>
               </section>
                 </a>
               <!--                用户动态操作-->
               <section class="user-dynamic-text-operation">
                   <section class="user-dynamic-text-operation-like">
                   <section class="user-dynamic-text-operation-like-icon" data-isLike="${val["isLike"]}"></section>
                   <p>${val['likeNum']}</p>
                   </section>
                   <section class="user-dynamic-text-operation-browse">
                   <section class="user-dynamic-text-operation-browse-icon"></section>
                   <p>${val['look']}</p>
                   </section>
                   <section class="user-dynamic-text-operation-transpond">
                   <section class="user-dynamic-text-operation-transpond-icon"></section>
                   <p>${val['forward']}</p>
                   </section>
                   </section>
                   </section>`
                } else {
                    homeScrollContent += `<section class="user-dynamic-text dynamic">
                 <a href="detailsPage.html" data-detailsId="${val['id']}">
                   <section class="user-dynamic-text-information">
                   <!--            用户动态信息头像-->
                   <section class="user-dynamic-text-information-headImg">
                  <p>${val.name.substr(-2)}</p>
                   </section>
                   <!--            用户动态发布信息-->
                   <section class="user-dynamic-text-release-information">
                   <section class="user-dynamic-text-release-information-details">
                   <!--              用户动态发布信息名称  -->
                   <section class="user-dynamic-text-release-information-name" data-uId="${val['uid']}"><p>${val['username']}</p></section>
               <!--                用户动态发布信息地点-->
               <section class="user-dynamic-text-release-information-address">
                   <p>${val['position']}</p>
                   <section class="user-dynamic-text-irelease-nformation-address-icon"></section>
                   </section>
                   </section>
                   <!--                用户动态发布信息发布时间-->
                   <section class="user-dynamic-text-release-information-time"><p>${val['time']}</p></section>
               </section>
               </section>
               <!--                用户动态关键字-->
               <section class="user-dynamic-text-keywords"><span>${val['label']}</section>
               <!--                用户动态内容-->
               <section class="user-dynamic-text-content">
                   <p>${val['title']}</p>
               </section>
                 </a>
               <!--                用户动态操作-->
               <section class="user-dynamic-text-operation">
                   <section class="user-dynamic-text-operation-like">
                   <section class="user-dynamic-text-operation-like-icon" data-isLike="${val["isLike"]}"></section>
                   <p>${val['likeNum']}</p>
                   </section>
                   <section class="user-dynamic-text-operation-browse">
                   <section class="user-dynamic-text-operation-browse-icon"></section>
                   <p>${val['look']}</p>
                   </section>
                   <section class="user-dynamic-text-operation-transpond">
                   <section class="user-dynamic-text-operation-transpond-icon"></section>
                   <p>${val['forward']}</p>
                   </section>
                   </section>
                   </section>`
                }
            }
        })
        /*        homeScrollContent += `<section class="end">
                <section></section>
                <p>到底了</p>
                </section>`*/
    } else {
        homeScrollContent = `<section class="no-content">
    <section></section>
    <p>暂无内容</p>
    </section>`
    }
    $(".end").before(homeScrollContent)

    //显示是否点赞
    $.each($(".user-dynamic-operation-like-icon"), function (i, val) {
        if ($(val).attr("data-islike") == 1) {
            $(this).css("background", "url('https://19jwshow.oss-cn-shenzhen.aliyuncs.com/images/Heart%403x.png') no-repeat center center")
        }
    })
    $.each($(".user-dynamic-text-operation-like-icon"), function (i, val) {
        if ($(val).attr("data-islike") == 1) {
            $(this).css("background", "url('https://19jwshow.oss-cn-shenzhen.aliyuncs.com/images/Heart%403x.png') no-repeat center center")
        }
    })
}

//查看学年
$(".school-year").on("click", function () {
    $(".school-year-box").css("display", "block")
    stop()
})
$(".school-year-box").on("click", function (e) {
    e.stopPropagation()
    $(".school-year-box").css("display", "none")
    move()
})
$(".each-school-year > label").on("click", function (e) {
    if ($(this).attr("data-yearnum")) {
        let schoolYearData = Sendajax("http://119.23.46.241:8080/home/year", "post", {
            year: parseInt($(this).attr("data-yearnum")),
            start: 0
        }, "")
        showDynamic(schoolYearData.data)
    } else {
        if (token) {
            homeData = Sendajax("http://119.23.46.241:8080/login/index", "post", {start: 0}, token)
            showDynamic(homeData.data)
        } else {
            homeData = Sendajax("http://119.23.46.241:8080/home/index", "post", {start: 0}, "")
            showDynamic(homeData.data)
        }
    }
})

$(".container").on("click", ".dynamic a", function () {
    localStorage.setItem("detailsId", $(this).attr('data-detailsId'))
})

//文图动态点赞功能
$(".container").on("click", ".user-dynamic-operation-like-icon", function () {
    let isLike = $(this).attr("data-islike")
    if (isLike == 0) {
        Sendajax("http://119.23.46.241:8080/login/likes", "post", {tid: parseInt($(this).parents(".user-dynamic-operation").siblings("a").attr("data-detailsid"))}, token)
        $(this).css("background", "url('https://19jwshow.oss-cn-shenzhen.aliyuncs.com/images/Heart%403x.png') no-repeat center center")
        $(this).siblings("p").text(parseInt($(this).siblings("p").text()) + 1)
        $(this).attr("data-islike", 1)
    } else if (isLike == 1) {
        Sendajax("http://119.23.46.241:8080/login/cancelLikes", "post", {tid: parseInt($(this).parents(".user-dynamic-operation").siblings("a").attr("data-detailsid"))}, token)
        $(this).css("background", "url('https://19jwshow.oss-cn-shenzhen.aliyuncs.com/images/greylike.png') no-repeat center center")
        $(this).siblings("p").text(parseInt($(this).siblings("p").text()) - 1)
        $(this).attr("data-islike", 0)
    } else {
        stop()
        layer.confirm('用户尚未登录，请先登录', {
            btn: ['确定']
            , btn1: function (index, layero) {
                window.location.href = 'userLoginPage.html'
                move()
            },
            title:'提示'
        });
    }
})

//文字动态点赞功能
$(".container").on("click", ".user-dynamic-text-operation-like-icon", function () {
    let isLike = $(this).attr("data-islike")
    if (isLike == 0) {
        //点赞
        Sendajax("http://119.23.46.241:8080/login/likes", "post", {tid: parseInt($(this).parents(".user-dynamic-text-operation").siblings("a").attr("data-detailsid"))}, token)
        $(this).css("background", "url('https://19jwshow.oss-cn-shenzhen.aliyuncs.com/images/Heart%403x.png') no-repeat center center")
        $(this).siblings("p").text(parseInt($(this).siblings("p").text()) + 1)
        $(this).attr("data-islike", 1)
    } else if (isLike == 1) {
        //取消点赞
        Sendajax("http://119.23.46.241:8080/login/cancelLikes", "post", {tid: parseInt($(this).parents(".user-dynamic-text-operation").siblings("a").attr("data-detailsid"))}, token)
        $(this).css("background", "url('https://19jwshow.oss-cn-shenzhen.aliyuncs.com/images/greylike.png') no-repeat center center")
        $(this).siblings("p").text(parseInt($(this).siblings("p").text()) - 1)
        $(this).attr("data-islike", 0)
    } else {
        stop()
        layer.confirm('用户尚未登录，请先登录', {
            btn: ['确定']
            , btn1: function (index, layero) {
                window.location.href = 'userLoginPage.html'
                move()
            },
            title:'提示'
        });
    }
})

//分享功能
$(".container").on("click", ".user-dynamic-operation-transpond", function () {
    let id = parseInt($(this).parent().siblings("a").attr("data-detailsid")),
        shareNum = $(this).find("p").text(),
        shareData = Sendajax("http://119.23.46.241:8080/home/share", "post", {id: id}, token)
    showShare(shareData.data)
    $(this).find("p").text(parseInt(shareNum) + 1)
    $(".share-box").css("display", "block").on("click", function () {
        $(this).css("display", "none")
        move()
    })
    stop()
})

$(".container").on("click", ".user-dynamic-text-operation-transpond", function () {
    let shareNum = $(this).find("p").text(),
        id = parseInt($(this).parent().siblings("a").attr("data-detailsid")),
        shareData = Sendajax("http://119.23.46.241:8080/home/share", "post", {id: id}, token)
    showShare(shareData.data)
    $(this).find("p").text(parseInt(shareNum) + 1)
    $(".share-box").css("display", "block").on("click", function () {
        $(this).css("display", "none")
        move()
    })
    stop()
})

//显示分享内容
function showShare(data) {
    if (data.titImg) {
        $(".share-box").html(`    <section class="share-box-images">
        <section class="share-box-images-header">
            <p>截图后发给想要分享的小伙伴吧</p>
            <p>识别图中二维码就可以观看啦</p>
        </section>
        <section class="share-box-images-content-image">
            <img src="${data.titImg}"  alt="">
        </section>
        <section class="share-box-images-content-text">
            <p>${data.title}</p>
        </section>
        <section class="share-box-images-information">
            <section class="share-box-images-username">${data.username}</section>
            <section>
                <section class="share-box-images-time">${data.time}</section>
                <section class="share-box-images-address">${data.position}</section>
            </section>
        </section>
        <section class="share-box-images-QRcode"><img src="${data.qrcodeUrl}"></section>
    </section>`)
    } else {
        $(".share-box").html(`<section class="share-box-text">
            <section class="share-box-text-header">
                <p>截图后发给想要分享的小伙伴吧</p>
                <p>识别图中二维码就可以观看啦</p>
            </section>
            <section class="share-box-text-content">
                <p>${data.title}</p>
            </section>
            <section class="share-box-text-information">
                <section class="share-box-text-username">${data.username}</section>
                <section>
                    <section class="share-box-text-time">${data.time}</section>
                    <section class="share-box-text-address">${data.position}</section>
                </section>
            </section>
            <section class="share-box-text-QRcode"><img src="${data.qrcodeUrl}"></section>
        </section>`)
    }
}

$("#back").on("click", function () {
    $("html,body").animate({scrollTop: 0}, 500);
})